package tenweek;

import java.util.Scanner;

class IllegalScoreException extends Exception {

	public IllegalScoreException(String xinxi) {
		super(xinxi);
	}
}

class IllegalNameException extends RuntimeException {

	public IllegalNameException(String xinxi) {
		super(xinxi);
	}
}

class Student {
	private String name;
	private int score;
	public String getName() {
		return name;
	}

	public void setName(String name) throws IllegalNameException {
		if (name.toCharArray()[0] >= '0' && name.toCharArray()[0] <= '9')
			throw new IllegalNameException("the first char of name must not be digit, name=" + name);
		this.name = name;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) throws IllegalScoreException {
		if (score < 0 || score > 100)
			throw new IllegalScoreException("score out of range, score=" + score);
		this.score = score;
	}
	

	@Override
	public String toString() {
		return "Student [name=" + name + ", score=" + score + "]";
	}

}

public class Fivefour {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			if (sc.next().equals("new")) {
				try {
					Student stu = new Student();
					stu.setName(sc.next());
					int score = sc.nextInt();
					stu.setScore(score);
					System.out.println(stu.toString());
				} catch (IllegalNameException e) {
					System.out.println(e);
					break;
				} catch (IllegalScoreException e) {
					System.out.println(e);
				}
			}
		}
		sc.close();
		System.out.println("scanner closed");

	}
}
